package com.example.client_anna.network.room.dao;

import androidx.lifecycle.LiveData;
import androidx.room.Dao;
import androidx.room.Delete;
import androidx.room.Insert;
import androidx.room.Query;
import androidx.room.Update;

import com.example.client_anna.network.room.entity.Goods;

import java.util.List;

@Dao
public interface GoodsDao {

    @Insert
    public void insertGoods(Goods... goods);

    @Delete
    public void deleteGoods(Goods... goods);

    @Update
    public void updateGoods(Goods... goods);

    @Query("SELECT * FROM ORDER_FOOD_DETAILS WHERE food_id = :fid")
    public Goods queryGoodsByFid(String fid);

    @Query("SELECT * FROM ORDER_FOOD_DETAILS WHERE bid = :bid")
    public List<Goods> queryGoodsByBid(String bid);

    @Query("SELECT * FROM ORDER_FOOD_DETAILS")
    public List<Goods> queryGoodsAll();

    //数据封装
    @Query("SELECT * FROM ORDER_FOOD_DETAILS")
    public LiveData<List<Goods>> queryGoodsByLiveData();

}
